Method and apparatus for active software disown of cache line&#39;s exlusive rights

ABSTRACT

Software indicates to hardware of a processing system that its storage modification to a particular cache line is done, and will not be doing any modification for the time being. With this indication, the processor actively releases its exclusive ownership by updating its line ownership from exclusive to read-only (or shared) in its own cache directory and in the storage controller (SC). By actively giving up the exclusive rights, another processor can immediately be given exclusive ownership to that said cache line without waiting on any processor&#39;s explicit cross invalidate acknowledgement. This invention also describes the hardware design needed to provide this support.

TRADEMARKS

IBM® is a registered trademark of International Business Machines Corporation, Armonk, N.Y., U.S.A. Other names used herein may be registered trademarks, trademarks or product names of International Business Machines Corporation or other companies.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to computer systems and in particular to systems which allow software to indicate to hardware that it should alter its cache state.

2. Description of Background

In a multiprocessing system where consistent memory usage model is required, memory usage among different processors is managed using cache coherency ownership schemes. These schemes usually involve various ownership states for a cache line. These states include read-only (or commonly known as shared), and exclusive (where a certain processor has the sole and explicit update rights to the cache line, sometimes known as store access).

For one such protocol used for a strongly-ordered memory consistency model, as in IBM's z/Architecture implemented by IBM System z processors, when a processor is requesting rights to update a line, e.g. when it is executing a “Store” instruction, it will check its local cache (L1) for the line's ownership state. If the processor finds out that the line is either currently shared or is not in its cache at all, it will then send an “exclusive ownership request” to the storage controller (SC) which serves as a central coherency manager.

The storage controller (SC) tracks which processor, if any, currently owns a line exclusively. If deemed necessary, the storage controller (SC) will then send a “cross interrogate” (XI) or “ownership change” request to another processor which currently owns that line to release its exclusive rights. Once the current owning processor has responded to the XI and responded that the exclusive ownership is released, the requesting processor will then be given exclusive update rights to the line requested.

In a large SMP (Symmetric Multi-Processing) system, it is common that various processes running on different processors update the same cache lines, but at different times. When a line is updated by one process, and then another process starts up, updating the same line by that other process will encounter delays required for XI acknowledgement while exchanging exclusive ownerships from one processor to another. These delays amount to a large performance degradation as number of processes goes up that reuse the same cache lines.

SUMMARY OF THE INVENTION

The shortcomings of the prior art are overcome and additional advantages are provided through the provision of a new instruction or instruction variation that allows software to indicate to hardware that its storage modification to a particular cache line is done, and will not be doing any modification for the time being

This invention, which allows software to indicate to hardware that its storage modification to a particular cache line is done and will not be doing any modification for the time being, allows the system to alter its cache state. With this indication, the processor can then actively release its exclusive ownership by updating its line ownership from exclusive to read-only (or shared) in its own cache directory and in the storage controller (SC). By actively giving up its exclusive rights, the first processor allows another processor to immediately be given exclusive ownership to that cache line without waiting on any processor's explicit cross invalidate acknowledgement. This invention provides a hardware design needed to provide this support.

After receiving such indication, a microprocessor can actively relinquish its exclusive ownership to a cache line, and preemptively update the ownership status in the storage controller to “shared”, thus removing delays due to XIs that would have otherwise been encountered by another processor should that processor request an exclusive ownership to the cache line.

The actual microprocessor implementation involves processing the instruction, and a new interface to communicate the “demote” request to the storage controller. It is also important to provide necessary interlock to prevent a premature launch of the “demote” request. For use in a microprocessor design with a direct connection to the storage controller, all prior committed storage update must be done prior to the actual demote status update in both directories of the requesting processor and storage, but not necessarily before a demote request is launched. For use in a microprocessor design with a private L2, an alternative design is described to ensure all prior committed storage updates are sent and are received in the storage controller before the “demote” request is sent.

System and computer program products corresponding to the above-summarized methods are also described and claimed herein.

Additional features and advantages are realized through the techniques of the present invention. Other embodiments and aspects of the invention are described in detail herein and are considered a part of the claimed invention. For a better understanding of the invention with advantages and features, refer to the description and to the drawings.

TECHNICAL EFFECTS

As a result of the summarized invention, technically we have achieved a solution which reduces the overhead of cache line sharing by multiple processes across a large SMP system that contains writeable data. The overall system wide performance can then be improved.

BRIEF DESCRIPTION OF THE DRAWINGS

The subject matter which is regarded as the invention is particularly pointed out and distinctly claimed in the claims at the conclusion of the specification. The foregoing and other objects, features, and advantages of the invention are apparent from the following detailed description taken in conjunction with the accompanying drawings in which:

FIG. 1 illustrates an initial state X where processor CPy owns line A exclusively;

FIG. 2 illustrates what happens when processor CPx needs line A exclusively after an initial state X;

FIG. 3 illustrates CPy executes a demote to line A after an initial state X;

FIG. 4 illustrates what happens when processor CPx needs line A exclusively after the demote process;

FIG. 5 illustrates a demote process for a different system design having private L2 cache;

FIG. 6 illustrates a typical processor that is executing the demote instruction.

The detailed description explains the preferred embodiments of the invention, together with advantages and features, by way of example with reference to the drawings.

DETAILED DESCRIPTION OF THE INVENTION

To allow software to indicate to the hardware a cache line is no longer required for further storage update, an instruction can be provided, with a way to indicate the logical address, as suited to a specific architecture. This is done with a new opcode or a new variation of an existing cache management instruction using unused fields or code-points. Specific instructions which implement this invention are expected to be used in device drivers, operating system code or any application that uses common parameter blocks or semaphore blocks.

The intention of this provision is that the software code will treat this as a “done with store to this line” instruction, now simply called “demote instruction”, at the end of its last storage updating instruction. It should be used for lines that contain highly utilized data across various processes that are executing in different processors and most likely at different times.

One typical software example may be on the management of a cache line that contains various semaphore locks needed for multiprocessor handling. The effect of the software using this provision will be to obtain or release a software lock managed in a cache line, and then demote the line actively. By releasing the line actively, other processes can proceed more quickly to either obtain or release the same lock or other locks managed within the same cache line.

An important thing is that the software application knows that this is the last point of update until some period of time later. If the software requires an update to the line soon after a “demote”, it would instead be bad for performance, since then the processor will take time to regain the exclusive rights.

Let's describe how this instruction is implemented in computer system with a cache hierarchy as illustrated in FIG. 1. This figure, and subsequent FIGS. 2-5, illustrates a bi-nodal system where the Storage Controller (SC) is made up of 2 different physical node controllers SC0 101 and SC1 102, each having 3 processors 103-105 or 106-108 attached.

FIG. 1 indicates a typical initial state where processor 103 (CPy) already owns the exclusive rights to a cache line A. FIG. 2 illustrates that when processor 107 (CPx) requests to have exclusive rights to same cache line A, (e.g. when it is executing a “Store” instruction and needs store access) while processing a storage update instruction, the wait on getting a confirmation on the cross interrogate (XI) from the current owning processor 103 (CPy) delays this requesting processor 107 (CPx) from being able to start any storage update to the line A. The steps 1-10 are shown in FIG. 2.

With the provision of a “demote” instruction, instead of having to take up the delay on the XI acknowledgement, the SCs 101 or 102 would have already updated its directory to show that no processor is currently owning the line exclusively, and thus can return the line A exclusively to processor 107 CPx when processor 107 CPx requests for it in a very timely manner. This is shown in FIGS. 3 and 4.

In FIG. 3, when the application running on processor 103 CPy decides to “demote” the cache line, processor 103 CPy will send a request to SC0 101 to demote line A (1). (There will be a decoding and execution of a program instruction calling for such a demotion) Once the demote request is received, the SC0 101 will process the request as if a “non-existing” processor is requesting line A exclusively. It will start up the lookup in its directory, send a cross interrogate to processor 103 CPy to request a release on exclusive rights (2). If processor 103 CPy still have storage update to that line pending in its pipeline, it can reject the cross interrogate. The SC0 101 will in turn repeat the cross interrogate until pending stores in processor 103 CPy are drained. When there is no pending stores for line A existing in processor 103 CPy, processor 103 CPy at this time should naturally be accepting the release request. Processor 103 CPy will update its directory with no more exclusive rights and send back an acknowledgement to SC0 101 (3). Once the acknowledgement is received, the SC0 101 will update its directory update to indicate that line A is now exclusive to “no one” (4). The software demote process is thus accomplished. This state of exclusive to no one is equivalent to a shared (or read-only) state with respect to how if affect exclusive XI activities concerning this line.

Now, as seen in FIG. 4, if another processor 107 CPx requests line A exclusively (1), the SC1 102 can quickly request the line exclusively from SC0 101 (2-4), and then reply to the requesting processor 107 CPx with an exclusive response (5-6) without acquiring any delay for cross interrogation towards processor 103 CPy. This reduction of delay could be even more apparent in a system if the Storage Controllers for nodes 101, 102 are on a different chip(s) than the processors, where the cross-chip communication is now removed.

To further describe a variant implementation of this demote instruction, we will illustrate with a system where there is one private Level 2 cache (L2) per processor. This is shown in FIG. 5. Each processor 103-108 in this system has a private L2 200.

In this design, when processor 103 CPy sends a demote request to its private L2 200 L2y (1), the L2 will lookup its directory, and then send a release exclusive cross interrogate back into the processor 103 CPy (2). If the Load Store Unit (LSU) inside the processor 103 CPy still has storage update to that line pending in its pipeline, it can reject the cross interrogate. The L2 200 L2y will in turn repeat the cross interrogate until pending stores in processor 103 CPy are drained. When there is no pending stores for line A, the LSU inside the processor 103 CPy will process the interrogate request, remove its directory status of exclusive ownership, and acknowledge to L2 200 L2y that this is done (3).

This private L2 200 L2y will drain any pending store to this line A, then also update its directory to indicate no exclusive ownership (4), and send a demote request to the SC0 101 (5). Upon receiving the demote request, SC0 101 will update its directory to indicate the line A is now exclusive to “no one” (6). With this illustration, it will be appreciated that this function can be implemented with various systems having a different cache hierarchy or topology than that illustrated. Because these can be implemented by those skilled in the art after learning of this teaching, all their variants are not specifically shown.

FIG. 6 illustrates how such an instruction is processed within a microprocessor core. For this description, only 3 of the key units IDU 301 (Instruction Dispatch Unit), FXU 302 (Fixed Point Unit), and LSU 303 (Load Store Unit) are depicted as part of the microprocessor CP 300.

During hardware execution of this instruction, the microprocessor pipeline will execute this instruction as a one cycle superscalar instruction that performs no architectural updates. All the work is to be performed by the cache subsystem.

For an in-order microprocessor CP 300, when the “demote instruction” is dispatched from the instruction dispatch unit IDU 301, the logical address calculated according to the instruction format and a decode of such instruction indicating a demote operation will be sent from IDU 301 to LSU 303 (arrow 1). In parallel, IDU 301 will send the opcode to FXU 302 (arrow 2) which will complete the instruction if this is the next to complete without waiting for any acknowledgement or doing any architectural update.

LSU 303 will obtain the absolute address used in cache management by either looking up the address translation of the logical address sent from IDU 301 in its translation lookaside buffer (TLB) 310, or obtain a translation result through a dynamic translation process. Once the absolute address is obtained (arrow 4), it will arm the absolute address and a demote command in one of its available Fetch Address Register (FAR) 312. The demote command will be a predefined interface value on the request bus (arrow 6) to the Storage Controller (SC) indicating a “demote” is to be performed.

The LSU's 303 control logic 313 will hold on to the demote request, and wait until all prior instructions complete before it send the demote request and address to the SC(arrow 6). This is done by monitoring pipeline flushing interface from the FXU 302 which controls instruction completion in this example. It is important that the demote request is not sent under an incorrectly predicted branch path, or if any older instruction does not successfully complete due to processor pipeline flushing conditions. Otherwise, an unnecessary performance penalty may be incurred.

In an out of order microprocessor, due to the nature of the design, the actual launch of the demote request from the LSU makes use of a tag. To fit into an out of order design, the demote request sitting in the FAR register is tagged with an instruction ID, and only launched when the global completion logic determines that this instruction ID is being completed.

An alternative design, not specifically shown in FIG. 5 but illustrated thereby, will have the demote request be written into a store queue entry (instead of a FAR register entry) at 312. By doing so, since stores have to be completed and processed in order for machines requiring a strongly-ordered memory model, the store queue logic at 312 will tagged its entries with instruction IDs and receive instruction completion ordering from the global completion logic. The store queue logic can then precisely send the demote request (through the FAR logic) without being premature. Additionally, any pending stores prior to the demote instruction will naturally be drained out of its pipeline before a demote request is sent. This helps in reducing the chance that the LSU needs to reject the demote cross interrogate when sent by the storage controller, or a private L2 if installed.

As illustrated, the present invention can help improve system performance by carefully inserting “demote” instructions in software code, with a hardware provision of such mechanism. It requires thoughtful implementation in software, firmware, together with hardware to be effective.

The flow diagrams depicted herein are just examples. There may be many variations to these diagrams or the steps (or operations) described therein without departing from the spirit of the invention. For instance, the steps may be performed in a differing order, or steps may be added, deleted or modified. All of these variations are considered a part of the claimed invention.

While the preferred embodiment to the invention has been described, it will be understood that those skilled in the art, both now and in the future, may make various improvements and enhancements which fall within the scope of the claims which follow. These claims should be construed to maintain the proper protection for the invention first described. 

1. A method for operating a computer system having a storage controller and a processing unit have a cache memory involving various ownership states as to a cache line, which states include a read-only or shared state and an exclusive state for holding the line exclusively, for software-initiated modification by hardware while the line is in said exclusive state, comprising the steps of: activating interface controls for allowing software running on said computer system to indicate to the processing unit that its storage modification of a particular cache line in the exclusive state is done, and will not be doing any modification for the time being, for an active software indication to disown a cache line's exclusive rights, and communicating with said storage controller said software indication that its storage modification of said particular cache line is done and that any modification will not be done for the time being, executing a demote request with regard to said particular cache line indicated by said software indication in said processing unit to cause the processing unit to actively relinquish control of its exclusive ownership of said particular cache line, and preemptively updating the ownership status in the storage controller of said particular cache line to a read-only or shared state and with said preemptive updating removing delays due to cross interrogates (XIs) that would have otherwise been encountered by another processor should that another processor request an exclusive ownership to the actively relinquished particular cache line.
 2. The computer system according to claim 1 wherein the software running on said computer system sends a indication that its storage modification of a particular cache line in the exclusive state is done, and will not be doing any modification for the time being when the software application knows that this is the last point of update until some period of time later.
 3. A computer system, comprising: a computer system having a storage controller and a processing unit coupled to cache memory involving various ownership states as to a cache line, which states include a read-only or shared state and an exclusive state for holding the line exclusive for software modification by hardware during the time that the line is in said exclusive state, and interface controls for allowing software running on said computer system to indicate to the hardware of the processing unit that its storage modification of a particular cache line in the exclusive state is done, and will not be doing any modification for the time being, for an active software indication to disown a cache line's exclusive rights, and said interface controls having an interface receiving mechanism for communicating with said storage controller said software indication that its storage modification of said particular cache line is done and that any modification will not be done for the time being, said interface controls preventing a premature launch of a demote request, and executing said a demote request with regard to said particular cache line indicated by said software indication in said processing unit to cause the processing unit to actively relinquish control of its exclusive ownership of said particular cache line and preemptively updating the ownership status in the storage controller of said particular cache line to a read-only or shared state and with said preemptive updating removing delays due to cross interrogates (XIs) that would have otherwise been encountered by another processor should that another processor request an exclusive ownership to the actively relinquished particular cache line.
 4. The computer system of claim 3 wherein said interface control ensures all prior committed storage updates are sent and received in the storage controller before a demote update is taken place for the requested cache line and said interface controls prevent a premature launch of said demote request.
 5. The computer system according to claim 3 wherein a demote request causes a storage controller to update its directory to show that no processor is currently owning the line exclusive, and thus can return the line exclusively to a processor of the computing system when said processor requests in a timely manner without waiting on getting a confirmation on a cross interrogate from a prior owning processor.
 6. The computer system according to claim 3 wherein when software running in a processor decides to demote a cache line the demoting processor sends a demote request to the storage controller, and once a demote request is received, the storage controller processes the request as if a non-existing processor is requesting a cache line exclusive and will start a directory search and send a cross interrogate to the processor owning exclusive rights to the requested cache line to request a release of exclusive rights, and when the storage controller receives acknowledgement of the request, it updates its directory to indicate that the requested line is now exclusive to no one processor to actively demote the particular requested cache line to a read-only or shared state.
 7. The computer system according to claim 3 wherein when a processor requests the particular cache line exclusive after a demote request has been implemented, the storage controller can allow the particular cache line to be made exclusive to the requesting processor and reply to the requesting processor with an exclusive response without cross interrogation towards another processor.
 8. The computer system according to claim 7 wherein the processing system has a first and a second storage controller and processors associated with each of said storage, and wherein said first storage controller is on one chip and said second storage controller is on the same or another chip and when a processor associated with the first storage controller requests a particular line exclusive associated with a processor of said second storage controller, the first storage controller requests the line exclusively from said second storage controller, and then replies to the requesting processor with an exclusive response without acquiring any delay for cross interrogation towards the processor associated with said processor of said second storage controller.
 9. The computer system according to claim 3 wherein a processor of the computer system has a private level 1 cache and when said private level 2 cache's processor sends a demote request to its private level 2 cache, that private level 2 cache will lookup its directory and then send a release exclusive cross interrogate back and the private level 2cache's processor will process the interrogate request, ensure no pending store to the requested line, and remove its directory status of exclusive ownership and acknowledge to the private level 2 cache that it has so done whereupon the private level 2 cache will ensure no pending store to the requested line, and also update its own directory to indicate no exclusive ownership and send a demote request to the storage controller, which then will update its directory to indicate that the line is now exclusive to no one.
 10. The computer system according to claim 3 wherein a processor is a microprocessor core having an instruction dispatch, a fixed point unit and a load store unit, and wherein a demote request is performed by the cache subsystem and the processor executes a demote as a one cycle superscalar instruction that performs no architectural updates.
 11. A computer system comprising: a storage controller, a plurality of processors forming a processing unit and a cache subsystem, and a cache interface establishing a direct connection between a processor and a storage controller upon receipt of a demote request issued by a processor of the processing units, said demote request being in response to an active software indication provided via software input to disown a cache line's exclusive rights of a processor to a particular cache line, and preemptively updating the ownership status in said storage controller of said computer system for said particular cache line upon receipt of said demote request to a read-only or shared state with said preemptive updating removing delays due to cross interrogates (XIs) that would have otherwise been encountered by another processor should that another processor request an exclusive ownership to the actively relinquished particular cache line.
 12. The computer system according to claim 11 wherein said storage controller upon receipt of a demote request said interface control ensures all prior committed storage updates are sent and received in the storage controller before a demote update is taken place for the requested cache line and said interface controls prevent a premature launch of said demote request.
 13. A method of managing storage updates in a computer system, comprising: providing via software input an active software indication to disown a particular cache line's exclusive rights when that a particular cache line is no longer required for any further storage update by a processor owning said particular cache line for store access, and treating said software indication that said particular cache line is no longer required for any further storage update as an indication that the processor is at the end of its last storage updating and can be demoted from its storage access status to be next used by any of various processes that are running on said computer system , and preemptively updating the ownership status in a storage controller of said computer system for said particular cache line to a read-only or shared state with said preemptive updating removing delays due to cross interrogates (XIs) that would have otherwise been encountered by another processor should that another processor request an exclusive ownership to the actively relinquished particular cache line.
 14. The method according to claim 13 wherein the software indication includes an indication of the logical address.
 15. The method according to claim 14 wherein said indication is a new opcode or instruction having code-points used for indicating that the indication is for a demote instruction.
 16. A method according to claim 13 wherein said method is used in a computer system having a microprocessor having an instruction dispatch unit, a fixed point unit and a load store, and includes the steps of: loading a cache subsystem with demote requests to be performed by the cache subsystem, and causing the processor to demote an exclusive particular cache line to a read-only or shared state preemptively updating the ownership status in the storage controller of said processor.
 17. The method according to claim 16 wherein a processor core in response to a demote request executes a demote instruction as a one cycle superscalar instruction that performs no architectural updates.
 18. The method according to claim 16 wherein the indication is provided by a connection between the processor and the storage controller.
 19. The method according to claim 18 wherein the processor has a private level 2 cache and when said private level 2cache's processor sends a demote request to its level 2 private cache, that private level 2cache will lookup its directory and then send a release exclusive cross interrogate back and the private level 2 cache's processor will process the interrogate request, ensure no pending store to requested line, and remove its directory status of exclusive ownership and acknowledge to the private level 2 cache that it has so done whereupon the private level 2cache will ensure no pending store to requested line, and also update its own directory to indicate no exclusive ownership and send a demote request to the storage controller, which then will update its directory to indicate that the line is now exclusive to no one. 